#encoding: utf8
import my_debugger
from my_debugger_defines import *



debugger = my_debugger.debugger()
#debugger.load("C:\\WINDOWS\\system32\\calc.exe")

pid = raw_input("Enter the PID of the process to attach to: ")
debugger.attach(int(pid))

thread_id_list = debugger.enumerate_threads()

# for i in range(10):
# #for thread_id in thread_id_list:
#     thread_context = debugger.get_thread_context(thread_id_list[0])
#     print("[*] dump registers for thread id: %d" %(thread_id_list[0]))

printf_address = debugger.func_resolve("msvcrt.dll", "printf")
print("[*] Address of printf: 0x%08x" %(printf_address))
debugger.bp_set_hw(printf_address, 1, HW_EXECUTE)

debugger.run()

debugger.detach()